﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace XinGuanERP.Models.Po.system
{
    public class SysActionLog : IEntity, IEntityTypeBuilder<SysActionLog>
    {
        public string? ActionId { get; set; }
        public string? ActionUserId { get; set; }
        public string? ActionUserName { get; set; }
        public string? RequestHost { get; set; }
        public string? RequestMethod { get; set; }
        public string? RequestPath { get; set; }
        public string? ActionName { get; set; }
        public string? RequestParams { get; set; }
        public DateTime? ActionTime { get; set; }
        public string? ResponseStatusCode { get; set; }

        public void Configure(EntityTypeBuilder<SysActionLog> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.ToTable("SYS_ACTION_LOG");
            entityBuilder.HasKey(t => t.ActionId);
            entityBuilder.Property(t => t.ActionId).HasColumnName("ACTIONID");
            entityBuilder.Property(t => t.ActionUserId).HasColumnName("ACTION_USERID");
            entityBuilder.Property(t => t.ActionUserName).HasColumnName("ACTION_USERNAME");
            entityBuilder.Property(t => t.RequestHost).HasColumnName("REQUEST_HOST");
            entityBuilder.Property(t => t.RequestMethod).HasColumnName("REQUEST_METHOD");
            entityBuilder.Property(t => t.RequestPath).HasColumnName("REQUEST_PATH");
            entityBuilder.Property(t => t.ActionName).HasColumnName("ACTION_NAME");
            entityBuilder.Property(t => t.RequestParams).HasColumnName("REQUEST_PARAMS");
            entityBuilder.Property(t => t.ActionTime).HasColumnName("ACTION_TIME");
            entityBuilder.Property(t => t.ResponseStatusCode).HasColumnName("RESPONSE_STATUS_CODE");
        }
    }
}
